﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kators.Services
{
    public class AgeService
    {

        public static int GetAgeFromDateOfBirth(DateTime dateOfBirth)
        {
            var age = DateTime.Now.Year - dateOfBirth.Year;

            if (DateTime.Now.Month < dateOfBirth.Month || (DateTime.Now.Month == dateOfBirth.Month && DateTime.Now.Day < dateOfBirth.Day))
                age--;

            return age;
        }

    }
}
